package com.imut.service.impl;

import com.imut.entity.NovelCategory;
import com.imut.mapper.CategoryMapper;
import com.imut.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public boolean insertCategory(NovelCategory novelCategory) {
        return categoryMapper.insertCategory(novelCategory);
    }

    @Override
    public boolean updateCategory(NovelCategory novelCategory) {
        return categoryMapper.updateCategory(novelCategory);
    }

    @Override
    public boolean deleteCategory(Integer id) {
        return categoryMapper.deleteCategory(id);
    }

    @Override
    public NovelCategory selectAllCategories(Integer id) {
        return categoryMapper.selectAllCategories(id);
    }

    @Override
    public List<NovelCategory> selectCategoryById() {
        return categoryMapper.selectCategoryById();
    }

    @Override
    public List<NovelCategory> selectCategoriesWithChildren(Integer parentId) {
        return categoryMapper.selectCategoriesWithChildren(parentId);
    }
}
